import request from '@/utils/request'

/**
 * 查询企业的部门列表
 */

export const reqGetDepartments = () => {
  return request({
    method: 'get',
    url: '/company/department'
  })
}

/**
 * 根据ID 删除部门
 */

export const resDelDpartment = (id) => {
  return request({
    method: 'delete',
    url: `/company/department/${id}`
  })
}

/**
 * 新增部门
 */

export const reqAddDepartment = (data) => {
  return request({
    method: 'post',
    url: '/company/department',
    data
  })
}

/**
 * 根据id查询部门详情
 */
export const reqGetDepartDetail = (id) => {
  return request({
    method: 'get',
    url: `/company/department/${id}`
  })
}

/**
 * 根据id更新部门详情
 * @param {*} form form一定要有id
 */
export const reqUpdateDepartDetail = (form) => {
  return request({
    method: 'put',
    url: `/company/department/${form.id}`,
    data: form
  })
}
